package com.kurumi.autoprint.pojo.prams;

import java.math.BigDecimal;

import org.apache.commons.lang3.StringUtils;

import com.kurumi.autoprint.enums.ResponseStatusEnum;
import com.kurumi.autoprint.util.Result;

public class OrderParam {
	private String name;
	private String mrId;
	private String onlyId;
	private String basicId;
	//打印类别
	private String printType;
	//打印份数
	private Integer printCopy;
	//打印总费用
	private BigDecimal printCost;
	//身份证号
	private String idCard;
	//打印总页数
	private Integer printTotalPages;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getMrId() {
		return mrId;
	}
	public void setMrId(String mrId) {
		this.mrId = mrId;
	}
	public String getOnlyId() {
		return onlyId;
	}
	public void setOnlyId(String onlyId) {
		this.onlyId = onlyId;
	}
	public String getBasicId() {
		return basicId;
	}
	public void setBasicId(String basicId) {
		this.basicId = basicId;
	}
	public String getPrintType() {
		return printType;
	}
	public void setPrintType(String printType) {
		this.printType = printType;
	}
	public Integer getPrintCopy() {
		return printCopy;
	}
	public void setPrintCopy(Integer printCopy) {
		this.printCopy = printCopy;
	}
	public BigDecimal getPrintCost() {
		return printCost;
	}
	public void setPrintCost(BigDecimal printCost) {
		this.printCost = printCost;
	}
	public String getIdCard() {
		return idCard;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	
	public Integer getPrintTotalPages() {
		return printTotalPages;
	}
	public void setPrintTotalPages(Integer printTotalPages) {
		this.printTotalPages = printTotalPages;
	}
	
	public Result fieldVerify(OrderParam orderParam) {
		if (orderParam.getPrintCost() == null) {
			return new Result(false, "打印费用不能为空!", null, ResponseStatusEnum.PARAM_VERIFY.getValue());
		}
		
		if (orderParam.getPrintCost().compareTo(new BigDecimal("0")) == -1) {
			return new Result(false, "打印费用不能小于0!", null, ResponseStatusEnum.PARAM_VERIFY.getValue());
		}
		
		if (orderParam.getPrintTotalPages() == null) {
			return new Result(false, "打印总页数不能为空!", null, ResponseStatusEnum.PARAM_VERIFY.getValue());
		}
		
		if (orderParam.getPrintTotalPages().intValue() <= 0) {
			return new Result(false, "打印总页数不能小于等于0页!", null, ResponseStatusEnum.PARAM_VERIFY.getValue()); 
		}
		
		if (StringUtils.isBlank(orderParam.getIdCard())) {
			return new Result(false, "身份证号不能为空!");
		}
		
		return new Result(true, "验证成功", null, 200);
	}
	
	@Override
	public String toString() {
		return "OrderParam [name=" + name + ", mrId=" + mrId + ", onlyId=" + onlyId + ", basicId=" + basicId
				+ ", printType=" + printType + ", printCopy=" + printCopy + ", printCost=" + printCost + ", idCard="
				+ idCard + ", printTotalPages=" + printTotalPages + "]";
	}
	

	

	
	
}




